package com.cjg.netCode;

import java.io.IOException;
import java.io.OutputStream;
import java.net.InetAddress;
import java.net.Socket;

public class clientNet {
    public static void main(String[] args) {
        //输入客户端输入 服务器地址
        try {
            InetAddress byName = InetAddress.getByName("127.0.0.1");
            int p =8888;
            Socket socket = new Socket(byName,p);
            //发送消息使用 io流
            OutputStream os = socket.getOutputStream();
            os.write("客户端给服务端发送了一个消息".getBytes());
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
